import { appTools, defineConfig } from '@modern-js/app-tools';
import { tailwindcssPlugin } from '@modern-js/plugin-tailwindcss';

// https://modernjs.dev/en/configure/app/usage
export default defineConfig<'rspack'>({
  runtime: {
    router: true,
  },
  plugins: [
    appTools({
      bundler: 'experimental-rspack',
    }),
    tailwindcssPlugin(),
  ],
  dev: {
    progressBar: { id: '🐹 少女祈祷中... ' },
    host: process.env.XHOST,
    port: Number(process.env.XPORT ?? 8080),
  },
  tools: {
    rspack: config => {
      config.experiments = {
        ...config.experiments,
        asyncWebAssembly: true,
        rspackFuture: {
          ...config.experiments?.rspackFuture,
          disableApplyEntryLazily: true,
        },
      };
      return config;
    },
  },
});
